package com.changhongit.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.changhongit.dao.ProductsDao;
import com.changhongit.entity.Products;
import com.changhongit.service.ProductsService;
import com.changhongit.util.PageView;

@Transactional
@Service("productsService")
public class ProductsServiceImpl implements ProductsService {
	@Autowired
	private ProductsDao productsDao;

	public PageView query(PageView pageView, Products products) {
		List<Products> list = productsDao.query(pageView, products);
		pageView.setRecords(list);
		return pageView;
	}

	public void add(Products products) {
		productsDao.add(products);
		
	}

	public void delete(String id) {
		productsDao.delete(id);
		
	}

	public Products getById(String id) {
		return productsDao.getById(id);
	}

	public void modify(Products products) {
		productsDao.modify(products);
	}

	public List<Products> findAll() {
		return productsDao.findAll();
	}

	public void saveProduct(Products products) {
		productsDao.saveProduct(products);
	}

}
